<html>
<head><meta charset="utf-8"><title>Dump stdlib MIR · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dump.20stdlib.20MIR.html">Dump stdlib MIR</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="223350471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dump%20stdlib%20MIR/near/223350471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> enterprisey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dump.20stdlib.20MIR.html#223350471">(Jan 20 2021 at 09:44)</a>:</h4>
<p>Can MIR for the stdlib be dumped too? I tried emitting MIR for the Hello World program, but it didn't give MIR for e.g. std::fmt::Arguments::new_v1.</p>



<a name="223366752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dump%20stdlib%20MIR/near/223366752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dump.20stdlib.20MIR.html#223366752">(Jan 20 2021 at 12:34)</a>:</h4>
<p><code>Arguments::new_v1</code> is neither <code>#[inline]</code> nor generic, so it's MIR is not included in the crate metadata by default as it wouldn't be used anyway. You can use <code>-Zalways-encode-mir</code> when building the sysroot to override this. For example miri does this to be able to interpret library functions.</p>



<a name="223368391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dump%20stdlib%20MIR/near/223368391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dump.20stdlib.20MIR.html#223368391">(Jan 20 2021 at 12:54)</a>:</h4>
<p><code>env RUSTFLAGS='-Zdump-mir=new_v1 -Zdump-mir-dir=/tmp/mir' cargo build -Zbuild-std --target x86_64-unknown-linux-gnu
</code></p>



<a name="223441097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Dump%20stdlib%20MIR/near/223441097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> enterprisey <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Dump.20stdlib.20MIR.html#223441097">(Jan 20 2021 at 21:52)</a>:</h4>
<p>Thank you both!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>